It works by creating a <textarea> element and injecting your encoded HTML into it. The browser automatically converts that back into proper HTML.
A robust HTML entity encoder/decoder written in JavaScript. It supports all standardized named character references as per HTML, handles ambiguous ampersands ...
I convert eg ' and to their corresponding HTML entities, eg &#039; for '. This works fine when displaying text on a web page. Only now I need to show these ...